<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>CreatePack</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">CreatePack()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#3A3966"><b>CreatePack</b></font>(#Pack, Filename$ [, Plugin])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Create a new empty pack file. If the file already exists, it will be replaced with a new empty file. 
Before creating a pack file, at least one packer has to be registered with one of the following 
command: <a href="usezippacker.html">UseZipPacker()</a>, <a href="usebrieflzpacker.html">UseBriefLZPacker()</a>. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Pack</i></td>
<td width="90%"> 
 
A number to identify the new pack file. <a href="../reference/purebasic_objects.html">#PB_Any</a> can be used as 
a parameter to auto-generate this number. 

 

</td></tr>
<tr><td><i>Filename$</i></td>
<td> 
 
The filename for the new pack file. 

 

</td></tr>
<tr><td><i>Plugin (optional)</i></td>
<td> 
The plugin to use, if more than one packer plugin has been registered. 它可以是以下值之一︰ 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_PackerPlugin_BriefLZ</font>: use the BriefLZ packer to create the pack file. <a href="usebrieflzpacker.html">UseBriefLZPacker()</a> has to be called to register the plugin.
  <font color="#924B72">#PB_PackerPlugin_Zip</font>    : use the Zip packer to create the pack file. <a href="usezippacker.html">UseZipPacker()</a> has to be called to register the plugin.
  <font color="#924B72">#PB_PackerPlugin_Lzma</font>   : use the Lzma packer to create the pack file (also known as 7z archive). <a href="uselzmapacker.html">UseLZMAPacker()</a> has to be called to register the plugin.
  <font color="#924B72">#PB_PackerPlugin_Tar</font>    : use the Tar packer to create the pack file. <a href="usetarpacker.html">UseTarPacker()</a> has to be called to register the plugin.
                             It can be combined with <font color="#924B72">#PB_Packer_Gzip</font> or <font color="#924B72">#PB_Packer_Bzip2</font> to create compressed tar archive.
</font></pre>

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Returns nonzero if the pack file has been successfully created, zero otherwise. If <font color="#924B72">#PB_Any</font> 
was used as the #Pack parameter then the generated pack number is returned. 

 

<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">  UseZipPacker</font>()

  <font color="#3A3966">; Create the packed file</font>
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreatePack</font>(0, "mycompressedfiles.zip")
  
    <font color="#3A3966">; add your files </font>
<font color="#3A3966">    AddPackFile</font>(0, "Image1.bmp", "Image1.bmp")  
<font color="#3A3966">    AddPackFile</font>(0, "Image2.bmp", "Image2.bmp") 
<font color="#3A3966">    AddPackFile</font>(0, "mywave1.wav", "mywave1.wav") 
<font color="#3A3966">    AddPackFile</font>(0, "mywave2.wav", "mywave2.wav") 
<font color="#3A3966">    ClosePack</font>(0)
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="closepack.html">ClosePack()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=compressmemory.html>CompressMemory()</a> - <a href="index.html">Packer Index</a> - <a href="examinepack.html">ExaminePack()</a> -&gt;<br><br>

</body></html>